package com.klxedu.ms.gateway.security.client;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.klxedu.ms.gateway.core.json.BaseJsonObject;
import com.klxedu.ms.gateway.security.client.service.LoginUser;

/**
 * 机构用户FeignClient
 * @author songhuiqing
 *
 */
@FeignClient(name = "MS-OUSER", url="${client.ms-ouser}")
public interface UserFeignClient {

	/**
	 * 根据账号获取登录用户
	 * @param userName 
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET, value = "/workbench/user/getLoginUser")
	public BaseJsonObject<LoginUser> getLoginUserByUserName(@RequestParam(name = "userName", required = true) String userName);
	
	/**
	 * 更新账号状态
	 * @param accountIds
	 * @param state
	 * @return
	 */
	@PutMapping("/workbench/user/account/updateAccountState")
	public BaseJsonObject<Object> updateAccountState(@RequestParam("accountIds") String[] accountIds,@RequestParam("state") Integer state);

	/**
	 * 根据wxAppid和wxOpenid获取登录用户
	 * @param wxAppid
	 * @param wxOpenid
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET, value = "/feign/user/getUserByWxOpenid")
	public BaseJsonObject<LoginUser>  getUserByWxOpenid(@RequestParam("wxAppid") String wxAppid, @RequestParam("wxOpenid") String wxOpenid);
}
